package com.all.service.impl;

import com.all.entity.User;
import com.all.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @Author LY
 * @create 2024/7/12 16:30
 * @Description 用户服务层
 */
@Slf4j
@Service
public class UserServiceImpl implements IUserService {

    // 保存用户信息
    public static final List<User> users = new CopyOnWriteArrayList<>();

    @Override
    public boolean addUser(User user) {
        log.info("保存用户信息：{}", user);
        users.add(user);
        return true;
    }

    @Override
    public List<User> getUsers() {
        log.info("获取用户信息");
        return users;
    }
}
